#include<bits/stdc++.h>
using namespace std;
int a[8101],b[8101],id[8101],c[8101];
void qsort(int l,int r)
{
	int t,m;
	int i,j;
	m=(b[l]+b[r])/2;
	i=l,j=r;
	while(i<=j)
	{
		while(b[i]<m)i++;
		while(b[j]>m)j--;
		if(i<=j)
		{
			t=b[i];b[i]=b[j];b[j]=t;
			t=id[i];id[i]=id[j];id[j]=t;
			i++;j--;
		}
	}
	if(l<j)qsort(l,j);
	if(i<r)qsort(i,r);
}
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		b[i]=a[i];
		id[i]=i;
	}
	qsort(1,n);
	for(int i=1;i<=n;i++)
	{
		c[id[i]]=i;
	}
	for(int i=1;i<=m;i++)
	{
		int p;
		scanf("%d",&p);
		if(p==1)
		{
			int x,v;
			scanf("%d%d",&x,&v);
			a[x]=v; 
			for(int j=1;j<=n;j++)
			{
				b[j]=a[j];
				id[j]=j;
			}
			qsort(1,n);
			for(int j=1;j<=n;j++)
			{
				c[id[j]]=j;
			}
		}
		if(p==2)
		{
			int x;
			scanf("%d",&x);
			printf("%d\n",c[x]);
		}
	}
}
